﻿Namespace ErrorHandling
    Public Class ErrorProviderEx
        Private mCount As Integer = 0
        Private mErrorProvider As System.Windows.Forms.ErrorProvider
        Public Sub New(ByVal errorProvider As System.Windows.Forms.ErrorProvider)
            mErrorProvider = errorProvider
            errorProvider.Clear()
        End Sub
        Public ReadOnly Property Count() As Integer
            Get
                Return mCount
            End Get
        End Property
        Public Sub AddError(ByVal control As System.Windows.Forms.Control, ByVal text As String)
            mErrorProvider.SetIconAlignment(control, ErrorIconAlignment.TopLeft)
            mErrorProvider.SetError(control, text)
            mCount += 1
        End Sub
    End Class
End Namespace